﻿<UserControl x:Class="Babe.Lua.ToolWindows.FolderWindow"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:ui="clr-namespace:Babe.Lua.ToolWindows"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="ResourceDic.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <DataTemplate x:Key="ListViewItemTemplate">
                <TextBlock Background="Transparent" MouseLeftButtonUp="ListView_SearchResult_MouseDown">
                    <TextBlock Text="{Binding Left}" Background="Transparent"/>
                    <TextBlock Text="{Binding Highlight}" Background="Transparent" Foreground="Blue" Margin="-3,0"/>
                    <TextBlock Text="{Binding Right}" Background="Transparent"/>
                </TextBlock>
            </DataTemplate>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid TextBlock.FontSize="12"
          Background="{DynamicResource {x:Static ui:Controls.BackgroundKey}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="25"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <TextBox x:Name="TextBox" Text="Search File" 
                 TextChanged="TextBox_TextChanged"
                 LostFocus="TextBox_LostFocus"
                 GotFocus="TextBox_GotFocus" 
                 PreviewKeyDown="TextBox_Search_KeyDown"
                 VerticalContentAlignment="Center"/>
        <TreeView x:Name="TreeView" Grid.Row="1"
                  
                  SelectedItemChanged="TreeView_SelectionChanged"
                  RequestBringIntoView="TreeView_RequestBringIntoView" IsTabStop="False">
            <TreeView.ContextMenu>
                <ContextMenu Focusable="False">
                    <MenuItem Focusable="False" Header="New File" Click="MenuItem_Click" x:Name="Menu_NewFile"/>
                    <MenuItem Focusable="False" Header="New Folder" Click="MenuItem_Click" x:Name="Menu_NewFolder"/>
                    <MenuItem Focusable="False" Header="ReName" Click="MenuItem_Click" x:Name="Menu_ReName"/>
                    <MenuItem Focusable="False" Header="Delete" Click="MenuItem_Click" x:Name="Menu_Delete"/>
					<MenuItem Focusable="False" Header="Open Contain Folder" Click="MenuItem_Click" x:Name="Menu_OpenContainFolder"/>
                </ContextMenu>
            </TreeView.ContextMenu>
        </TreeView>
        <ListBox x:Name="SearchView" Visibility="Collapsed" Grid.Row="1"
                  VerticalAlignment="Top"
                  ItemTemplate="{DynamicResource ListViewItemTemplate}"
                  HorizontalContentAlignment="Stretch"
                  >
        </ListBox>
    </Grid>
</UserControl>
